import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;

public class MethodRunner 
{
	public static void main(String[] args)
	{
		String className = args[0];
		String methodName = args[1];
		
		try 
		{
			Class<?> c = Class.forName(className);
			Method m = c.getMethod(methodName);
			
			Object i = c.newInstance();
			
			m.invoke(i);
		} 
		catch (ClassNotFoundException e) 
		{
			System.err.println("Error: no such class found: " + className + ".");
		} 
		catch (NoSuchMethodException e) 
		{
			System.err.println("Error: no such method found: " + methodName + ".");
		} 
		catch (IllegalArgumentException e) 
		{
			System.err.println("Error: method should be static without parameters.");
		} 
		catch (IllegalAccessException e) 
		{
			System.err.println("Error: illegal access.");
		} 
		catch (InvocationTargetException e) 
		{
			e.printStackTrace();
		}
		catch (InstantiationException e)
		{
			System.err.println("Error: cannot create instance.");
		}
	}
}
